<template>
  <div class="dashboard-container">
    <div class="dashboard-text">欢迎您: {{ username }}</div>
  </div>

</template>

<script>
  import Cookies from 'js-cookie'
  // 编写vue.js代码
  export default {
    data () {
      return {
        // 组件中使用的各种属性
        username: ''
      };
    },
    // 编写各种事件方法
    methods: {
      login(){
        let username=Cookies.get("user_name");
        this.username=username;
        console.log(username+111);
        if (username==null){
          this.$router.push({ path: this.redirect || '/login'})
        }
      },
    },
    // 编写页面加载时执行的代码
    mounted () {
      this.login();
    }
  };
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
